# All comands from root! # /deb/sdb - NAS HDD! # Prepare... apt-get install build-essential uboot-mkimage libncurses-dev qemu-user-static debootstrap mkdir /build cd /build # Download and extract cross-compile to /build/cross-tools # Download and extract wd-source-code-gpl to /build/ cd packages/kernel_3.2/ make TOOLCHAIN_DIR=/build/cross-tools/arm-linux-gnueabihf CROSS_COMPILE=arm-linux-gnueabihf- config make TOOLCHAIN_DIR=/build/cross-tools/arm-linux-gnueabihf CROSS_COMPILE=arm-linux-gnueabihf- menuconfig make TOOLCHAIN_DIR=/build/cross-tools/arm-linux-gnueabihf CROSS_COMPILE=arm-linux-gnueabihf- all # Repleace kernel on HDD: dd if=_bin/uImage of=/dev/sdb5 # Generate clean rootfs: mkdir /debian cd /debian debootstrap --arch=armhf --foreign wheezy . # Need for chroot (if host arch = x32/x64) cp /usr/bin/qemu-arm-static usr/bin/ LC_ALL=C LANGUAGE=C LANG=C chroot . /debootstrap/debootstrap --second-stage # Copy kernel modules cp /build/kernel_3.2/_bin/lib/* lib/ -R # Mount necessary fs mount -t proc proc proc/ mount -t sysfs sys sys/ mount -o bind /dev dev/ # Login to chroot and continue configuration: (Dot at end needed!) LC_ALL=C LANGUAGE=C LANG=C chroot . # Set root password for new system! passwd # Set hostname nano /etc/hostname # Add nameservers for first use nano /etc/resolv.conf # ADD: nameserver 8.8.8.8 nameserver 8.8.4.4 nano /etc/apt/sources.list # Add or replace: deb http://ftp.ru.debian.org/debian wheezy main deb-src http://ftp.ru.debian.org/debian wheezy main deb http://security.debian.org/ wheezy/updates main deb-src http://security.debian.org/ wheezy/updates main # Configure network: nano etc/network/interfaces # Add: auto eth0 allow-hotplug eth0 iface eth0 inet dhcp # Edit inittab: nano /etc/inittab # Add to end: T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 # Remove or replace: #1:2345:respawn:/sbin/getty 38400 tty1 #2:23:respawn:/sbin/getty 38400 tty2 #3:23:respawn:/sbin/getty 38400 tty3 #4:23:respawn:/sbin/getty 38400 tty4 #5:23:respawn:/sbin/getty 38400 tty5 #6:23:respawn:/sbin/getty 38400 tty6 # Upgrade system packages apt-get update apt-get upgrade apt-get install openssh-server dialog locales dpkg-dev # Select en_US.UTF-8 and ru_RU.UTF-8 (Or other, if you need it). Then chose default locale. dpkg-reconfigure locales # Add missing data for PFE (Network module) nano /lib/modules/3.2.26/modules.symbols # Add: alias symbol:comcerto_fpp_send_command pfe alias symbol:comcerto_fpp_register_event_cb pfe nano /lib/modules/3.2.26/modules.dep # Add: kernel/pfe.ko: nano /etc/modules # Add: pfe lro_mode=1 tx_qos=1 alloc_on_init=1 disable_wifi_offload=1 # Run depmod for check if all correct: depmod # Configure fstab: nano /etc/fstab # Replace: # Default mounts for WDMyCloud /dev/root / ext3 defaults 0 1 /dev/sda3 none swap sw 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 tmpfs /tmp tmpfs rw,size=64M 0 0 # CryptoFS From WD. Not present in kernel. #cgroup /sys/fs/cgroup cgroup memory,cpu 0 0 # Data ("Shares" in original firmware) /dev/sda4 /data ext4 defaults 0 0 exit mdadm -A -D /dev/md0 /dev/sdb1 /dev/sdb2 mkdir /mnt/md mount /dev/md0 /mnt/md cp /debian/* /mnt/md/ -R umount /mnt/md # Thats all! Tuning: echo 1 > /sys/block/sda/bdi/cpu0_bind echo 4096 > /sys/block/sda/bdi/read_ahead_kb echo cfq > /sys/block/sda/queue/scheduler